<%--
Created by IntelliJ IDEA.
User: hansonghe
Date: 15/10/12
Time: 17:09
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" type="text/css" href="/resource/css/main.css" />
    <style type="text/css">
        td{
            text-align: center;
            border: solid grey 1px;

            white-space:nowrap;/* 不换行 */
            overflow:hidden;/* 内容超出宽度时隐藏超出部分的内容 */
            text-overflow:ellipsis;
        }
    </style>
    <script type="text/javascript" src="/resource/script/jquery.js"></script>
    <script type="text/javascript" src="/resource/script/jquery.watermark.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $("#txtTelNum").watermark({
                watermarkText: "用户的手机号",
                className: "watermark"
            });

            $("#btnSearch").click(function(){
                var tel = $("#txtTelNum").val();
                $.post("/order/list",
                    {
                        telNum:tel
                    },
                    function(data, status){
                        if(status == "success"){
                            if (data.result){
                                $("#tbOrder").html(data.orderList);
                            }
                            else {
                                $("#tbOrder").html(" ");
                                alert(data.errorMsg);
                            }
                        }
                        else {
                            alert("网络请求出错，请重新再试！");
                        }
                    }
                );
            });

            $("#btnClose").click(function(){
                $("#divOrder").fadeOut();
                $("#divCover").fadeOut(200);
            });
        });

        function viewOrderDetail(oid){
            $("#divCover").fadeIn();
            $.post("/order/detail",
                {
                    orderId:oid
                },
                function(data, status){
                    if(status == "success"){
                        if (data.result){
                            $("#pNum").text(data.orderId);
                            $("#pPhone").text(data.customerPhone);
                            $("#pName").text(data.orderName);
                            $("#pTime").text(data.appointmentTime);
                            $("#pMasterName").text(data.masterShopName);
                            $("#pSlaveName").text(data.slaveShopName);
                            $("#pBarber").text(data.barberName);
                            $("#pPrice").text("￥" + data.price);
                            $("#pCoupon").text("￥" + data.coupon);
                            $("#pRealPrice").text("￥" + data.realPrice);
                            $("#pCreateTime").text(data.createTime);

                            $("#divOrder").show(200);
                        }
                        else {
                            $("#divCover").fadeOut();
                            alert(data.errorMsg);
                        }
                    }
                    else {
                        $("#divCover").fadeOut();
                        alert("网络请求出错，请重新再试！");
                    }
                }
            );
        }

        function orderRefund(oid){
            $.post("/order/refund",
                {
                    orderId:oid
                },
                function(data, status){
                    if(status == "success"){
                        if (data.result){
                            alert("设置退款成功！");
                        }
                        else {
                            alert(data.errorMsg);
                        }
                    }
                    else {
                        alert("网络请求出错，请重新再试！");
                    }
                }
            );
        }
    </script>
</head>
<body>
<input id="txtTelNum" type="text" style="width: 313px; height: 40px; padding-left: 15px; padding-right: 15px; left:50px; top: 50px; border: none; background-image: url('/resource/img/search_input.png')" />
<input id="btnSearch" type="button" style="width: 40px; height: 40px;-moz-background-size:100% 100%; background-size:100% 100%; background-image: url('/resource/img/search.png')" >

<table id="tBarberInfo" style=" border: solid grey 1px;">
    <tr>
        <td width="120px">订单编号</td>
        <td width="120px">用户手机号</td>
        <td width="90px">订单名称</td>
        <td width="200px">预约时间</td>
        <td width="120px">品牌店</td>
        <td width="120px">分店名</td>
        <td width="100px">服务技师</td>
        <td width="80px">订单金额</td>
        <td width="100px">订单状态</td>
        <td width="70px">操作</td>
    </tr>
    <tbody id="tbOrder">
    </tbody>
</table>

<div id="divCover" class="divMask" style="display: none"></div>
<div id="divOrder" style="position: absolute; width: 480px; height: 520px; left: 50%; margin-left: -240px; top: 10px; background-color: #FFFFFF; z-index: 10; display: none;">
    <table style="width: 100%; margin-top: 30px; height: 420px;">
        <tr><td>订单编号</td><td><p id="pNum"></p></td></tr>
        <tr><td>顾客手机号</td><td><p id="pPhone"></p></td></tr>
        <tr><td>订单名称</td><td><p id="pName"></p></td></tr>
        <tr><td>预约时间</td><td><p id="pTime"></p></td></tr>
        <tr><td>品牌店</td><td><p id="pMasterName"></p></td></tr>
        <tr><td>分店名</td><td><p id="pSlaveName"></p></td></tr>
        <tr><td>服务技师</td><td><p id="pBarber"></p></td></tr>
        <tr><td>订单金额</td><td><p id="pPrice"></p></td></tr>
        <tr><td>优惠劵</td><td><p id="pCoupon"></p></td></tr>
        <tr><td>实际支付</td><td><p id="pRealPrice"></p></td></tr>
        <tr><td>订单创建时间</td><td><p id="pCreateTime"></p></td></tr>
    </table>

    <input id="btnClose" type="button" value="关闭" style="position: absolute; bottom: 30px; right: 20px;">
</div>
</body>
</html>